package Code;

import shouji.My_Phone;

/**
 * @author zihao
 * @date 2025/3/18 19:43
 * @VERSION
 * @description
 **/
public class Person {
    private String name;
    private int age;
    //行为
    public void display(){
        System.out.println(name+"享年"+age+"岁");
    }
    //构造方法
    //无参构造
    public Person() {
    }
    //满参构造
    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    //getter and setter

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public static void main(String[] args) {
        Person person=new Person();
        person.setAge(50);
        person.setName("宋志涵");
        person.getName();
        person.getAge();
        person.display();
    }
}
